﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using DEsbInterface;
using A2DFramework.InternalCommunicationService;
using System.Transactions;

namespace ICSTestConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("broker created.");

            string result = string.Empty;
            using (TransactionScope ts = new TransactionScope())
            {
                Console.WriteLine("Client");
                Console.WriteLine("           DistributedIdentifier: " + Transaction.Current.TransactionInformation.DistributedIdentifier);
                Console.WriteLine("           LocalIdentifier: " + Transaction.Current.TransactionInformation.LocalIdentifier);

                //IUser userSrv = ICSFactory.Create<IUser>();
                IAdmin adminSrv = ICSFactory.Create<IAdmin>();
                IAdmin adminSrv2 = ICSFactory.Create<IAdmin>("2.0");

                //result = userSrv.GetUserName("1", "2", "3");
                result = adminSrv.CheckPermission(100).ToString();
                adminSrv2.CheckPermission(100).ToString();

                ts.Complete();

                //ICSFactory.Close(userSrv);
                ICSFactory.Close(adminSrv);
                ICSFactory.Close(adminSrv2);
            }

            //IUser userSrv = ICSFactory.Create<IUser>();
            //var result = userSrv.GetUserName("1", "2", "3");
            //ICSFactory.Close(userSrv);

            Console.ReadKey();
        }
    }
}